package org.hhchat.others.wangyi.p2018;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

/**
 * Created this one by huminghao on 2018/3/27.
 */
public class P3 {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int m = in.nextInt();
            Work[] works = new Work[n];
            for(int i = 0; i<n;i++) {
                works[i] = new Work(in.nextInt(), in.nextInt());
            }
            int a[] = new int[m];
            for(int i = 0 ; i < m;i++) {
                a[i] = in.nextInt();
            }

            Arrays.sort(works, Comparator.comparingInt(w -> w.d));

            int max = 0;
            //for(int threshold:)


        }

    }

    static class Work{
        public Work(int d, int p){
            this.d = d;
            this.p = p;
        }
        int p;
        int d;
    }

}
